// 状态管理
const state = {
  count: 2,
  uploadImgUrl: '',
  uploadMutiImgUrl: [],
  uploadVideoUrl: '',
  notifyTeams: [],
  isShowSilde: false,
  putUpCartNum: '',
  login_info: {
    store_id: '123456'
  }
}

const mutations = {
  // 改变起的订单数量
  changeputUpCartNum (state, number) {
    state.putUpCartNum = number
  },
  changeSildeState (state, bool) {
    state.isShowSilde = bool
  },
  increment (state) {
    state.count++
  },
  updateUploadImgUrl (state, url) {
    state.uploadImgUrl = url
  },
  updateUploadMutiImgUrl (state, urlArr) {
    state.uploadMutiImgUrl = urlArr
  },
  updateUploadVideoUrl (state, url) {
    state.uploadVideoUrl = url
  },
  updateNotifyTeams (state, array) {
    state.notifyTeams = array
  },
  deleteNotifyTeams (state, id) {
    let array = state.notifyTeams
    let tempArr = []
    for (var i = 0; i < array.length; i++) {
      if (array[i].id !== id) {
        tempArr.push(array[i])
      }
    }
    state.notifyTeams = tempArr
  }
}

const actions = {
  someAsyncTask ({ commit }) {
    // do something async
    commit('INCREMENT_MAIN_COUNTER')
  }
}

export default {
  state,
  mutations,
  actions
}
